<#macro upload uploadBtnId success fileType>
<form id="fileUploadForm" method="post" enctype="multipart/form-data" action="${absoluteContextPath}/upload/ajax"
      style="display: none">
    <input type="file" name="file"/>
    <input type="text" name="fileType" value="${fileType}">
</form>
<script>
    $(function () {
        $("#" + "${uploadBtnId}").click(function () {
            $("#fileUploadForm input[type=file]").click();
        });

        $("#fileUploadForm input[name=file]").live("change", function () {
            $("#fileUploadForm").ajaxSubmit({
                success: function (data) {
                    ${success}(data);
                    $("#fileUploadForm input[type=file]").val("");
                }
            });
        });
    });
</script>
</#macro>
